package com.example.ythhome.person.api;


import com.example.ythhome.person.entity.HomePersonPo;
import com.example.ythhome.person.service.HomePersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("api/person")
public class HomePersonController {
//

    @Autowired
    HomePersonService homePersonService;


    public boolean isPerson(boolean i){
        return i;
    }
    @PostMapping("/add")
    public boolean addPerson(HomePersonPo homePersonPo){
        return  homePersonService.insert(homePersonPo);
    };

    @PostMapping("/query")
    @ResponseBody
    public List<HomePersonPo> queryPerson(){
        return  homePersonService.queryAll();
    };
    @GetMapping("/query")
    @ResponseBody
    public List<HomePersonPo> queryPerson1(){
        return  homePersonService.queryAll();
    };
}
